﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    public class Mutation
    {
        public double probability;

        public Mutation(double probability)
        {
            this.probability = probability;
        }

        public bool[] doMutation(bool[] child)
        {
            Random generator = new Random();
            double num;

            for (int i = 0; i < child.Length; i++)
            {
                num = generator.NextDouble();
                if (num <= probability)
                    child[i] = !child[i];
            }

            return child;
        }
    }
}
